<?php
defined('SYSPATH') or die('No direct access allowed.');

class Service_olduser{

	//通过新的ERP用户id获取老的ERP的用户信息
	static function Get_old_user_by_new_id($new_user_id=NULL)
	{
		$user_id = $new_user_id?$new_user_id:User::active_user()->id;
		if(empty($user_id))
		{
			return;
		}

		$user_name = ORM::factory('user',$user_id)->name;
		if(empty($user_name))
		{
			return;
		}

//      --------------------------------------kdw------------------------------------
//		return DB::select()
//		->from('erp_manages')
//		->where('username','=',$user_name)
//		->execute('readonlyerp')
//		->current();

        return Skusystemapi::getUser($user_name);
//      --------------------------------------kdw-end--------------------------------
	}

	//获取老的ERP用户信息
	static function Get_old_user_by_old_id($old_user_id=NULL)
	{
//		if($old_user_id)
//		{
//			return DB::select()
//				->from('erp_manages')
//				->where('id','=',$old_user_id)
//				->execute('readonlyerp')
//				->current();
//		}
	}
}